﻿using UnityEngine;
using UnityEditor;
using System;
using Sirenix.OdinInspector;
using System.Collections.Generic;

//子弹位置和目标数据
[Serializable]
public class BulletSiteTargetData : MyScriptableObject
{

    //############技能位置和朝向（LOGIC）
    //初始位置和朝向 0.固定位置. 1.活动位置（对应单位）
    [ValueDropdown("SkillSiteTargetEnum")]
    [LabelText("位置类型")]
    public int initialPositionType;

    #region 固定位置属性
    //固定坐标
    [LabelText("坐标")]
    [HideIf("@this.initialPositionType != 0")]
    public Vector2 fixedPos;
    //固定坐标的朝向
    [LabelText("朝向")]
    [HideIf("@this.initialPositionType != 0")]
    public Vector2 fixedDir;
    //是否根据施法者朝向为标准
    [ValueDropdown("SkillSiteTargetDirEnum")]
    [LabelText("朝向标准")]
    [HideIf("@this.initialPositionType != 0")]
    public bool fixedDirByUsers;
    #endregion

    #region 活动位置属性
    //初始活动位置类型 0.施法者本身 1.作用目标
    [HideIf("@this.initialPositionType != 1")]
    [ValueDropdown("SkillSiteTargetOtherTypeEnum")]
    [LabelText("子弹初始目标类型")]
    public int otherType;
    //移动目标位置类型 0.施法者本身 1.作用目标
    [HideIf("@this.initialPositionType != 1")]
    [ValueDropdown("SkillSiteTargetOtherTypeEnum")]
    [LabelText("子弹作用目标类型")]
    public int targetOtherType;
    //筛选多少范围内的单位
    [HideIf("@this.initialPositionType != 1 ")]
    [LabelText("子弹目标筛选范围")]
    [Range(0, 100)]
    public float selectRange;
    //筛选类型 0.距离 1.随机
    [HideIf("@this.initialPositionType != 1")]
    [LabelText("筛选类型")]
    [ValueDropdown("SkillSiteTargetSelectTypeEnum")]
    public int selectType;
    //筛选类型的决定值 0.最小值 1最大值 
    [HideIf("@this.initialPositionType != 1")]
    [HideIf("@this.selectType == 1")]
    [LabelText("筛选条件")]
    [ValueDropdown("SkillSiteTargetSelectConditionEnum")]
    public int selectCondition;
    //选择阵营类型 0.我方 1.敌方 2.混合
    [HideIf("@this.initialPositionType != 1")]
    [LabelText("筛选阵营")]
    [ValueDropdown("SkillSiteTargetSelectCampEnum")]
    public int selectCamp;
    //重复类型：1。（不重复） 2.（不是当前）3.重复
    [HideIf("@this.initialPositionType != 1")]
    [LabelText("筛选是否能重复")]
    [ValueDropdown("SkillSiteTargetRepeatTypeEnum")]
    public int repeatType;
    #endregion

#if UNITY_EDITOR

    private List<ValueDropdownItem<int>> SkillSiteTargetEnum = new ValueDropdownList<int>()
    {
      { "固定位置", 0 },
      { "活动位置", 1 },
    };

    private List<ValueDropdownItem<bool>> SkillSiteTargetDirEnum = new ValueDropdownList<bool>()
    {
      { "施法者朝向", true },
      { "标准朝向", false },
    };

    private List<ValueDropdownItem<int>> SkillSiteTargetOtherTypeEnum = new ValueDropdownList<int>()
    {
      { "施法者本身", 0 },
      { "作用目标", 1 },
    };

    private List<ValueDropdownItem<int>> SkillSiteTargetSelectTypeEnum = new ValueDropdownList<int>()
    {
      { "距离", 0 },
      { "随机", 1 },
    };

    private List<ValueDropdownItem<int>> SkillSiteTargetRepeatTypeEnum = new ValueDropdownList<int>()
    {
      { "不重复", 0 },
      { "不选择当前目标", 1 },
      { "可以重复", 2 },
    };

    private List<ValueDropdownItem<int>> SkillSiteTargetSelectCampEnum = new ValueDropdownList<int>()
    {
      { "我方", 0 },
      { "敌方", 1 },
      { "混合", 2 },
    };

    private List<ValueDropdownItem<int>> SkillSiteTargetSelectConditionEnum = new ValueDropdownList<int>()
    {
      { "最小值", 0 },
      { "最大值", 1 },
    };
#endif
}
